package com.mycjj.android.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;

import com.mycjj.android.R;
import com.mycjj.android.bean.Adviser;
import com.nostra13.universalimageloader.core.DisplayImageOptions;

public class AdviserAdapter extends TAdapter<Adviser> {

	private String type;
	public AdviserAdapter(Context mContext,String type) {
		super(mContext);
		this.type = type;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder;
		if (convertView == null) {
			convertView = LayoutInflater.from(mContext).inflate(
					R.layout.item_select_adviser_view, null);
			holder = new ViewHolder();
			holder.pic = (ImageView) convertView
					.findViewById(R.id.header_pic);
			holder.tv_name = (TextView) convertView
					.findViewById(R.id.tv_name);
			holder.tv_yuyue = (TextView) convertView
					.findViewById(R.id.tv_yuyue);
//			holder.rb = (RatingBar) convertView.findViewById(R.id.rb);
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		Adviser adviser = mList.get(position);
		holder.tv_name.setText(adviser.getName());
		holder.tv_yuyue.setText(type);
		DisplayImageOptions options = new DisplayImageOptions.Builder()
		.showImageForEmptyUri(R.drawable.katong)
		.showImageOnFail(R.drawable.katong)
		.cacheInMemory(true)
		.cacheOnDisk(true)
		.considerExifParams(true)
//		.displayer(new RoundedBitmapDisplayer(20))
		.build();
//		imageLoader.displayImage(adviser.getAvater(), holder.pic);
		imageLoader1.displayImage(adviser.getAvater(), holder.pic, options, animateFirstListener);
		return convertView;
	}


	class ViewHolder {
		ImageView pic;
		TextView tv_name;
		TextView tv_yuyue;
		RatingBar rb;

	}

}
